const fs = require('fs');

// // 创建一个可读流
// const reader = fs.createReadStream('./abc.txt', { encoding: 'utf8' });
//
// // 监听 'data' 事件，逐块读取文件内容
// reader.on('data',(chunk) => {
//     console.log('chunk:', chunk);
// })

const ws = fs.createWriteStream('output.txt', { encoding: 'utf8' });

ws.write('Hello, world!\n');
ws.write('This is a test.\n');

ws.end(() => {
    console.log('数据写入完毕');
});